<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/commons/global.jsp"%>

<div id="tagAddDiv" class="easyui-window" title="添加标签"
	style="width: 400px; height: 300px"
	data-options="iconCls:'icon-cog',modal:true,openAnimation:'fade',closeAnimation:'slide',cache:false,collapsible:false,minimizable:false,maximizable:false">
	<div class="content-wrapper">
		<form id="tagAddForm" method="post" style="padding: 10px;">
			<input id="tagAddForm-name" type="text" name="name"
				style="width: 100%;" /> <input type="button" value="添  加"
				onclick="$('#tagAddForm').submit();"
				style="float: right; margin-top: 10px;" />
			<div style="clear: both;"></div>
		</form>
	</div>
</div>

<script type="text/javascript">
	var tagAddForm_name = undefined;
	$(function() {
		tagAddForm_name = $('#tagAddForm-name').textbox({
			buttonText : '名&nbsp;&nbsp;&nbsp;&nbsp;称',
			buttonAlign : 'left'
		});

		var tagAddDiv = $('#tagAddDiv').window({
			onBeforeClose : function() {

			},
			onClose : function() {
				tagAddDiv.panel('destroy');
				try {
					tagListDatagrid.datagrid('reload');
				} catch (e) {
				}
			}
		});

		$('#tagAddForm').form({
			url : baseUrl + '/tag/add',
			onSubmit : function() {
				var name = tagAddForm_name.textbox('getValue');
				if (!name) {
					$.messager.alert('提示', '请输入名称', 'warning');
					return false;
				}
			},
			success : function(data) {
				data = eval("(" + data + ")");
				if (data.responseCode == '000') {
					$.messager.alert('提示', '添加成功!', 'info');
				} else {
					$.messager.alert('提示', data.responseMessage, 'error');
				}
			}
		});

	});
</script>